<!DOCTYPE HTML>
<html>
	<head>
		<?php

	  if (isset($title)) {
	      $this->assign('title', $title);
	  }

		//echo $this->Html->css('cake.generic');
		echo $this->Html->css('bootstrap');
		echo $this->Html->css('style');
		echo $this->Html->css('etalage');
		echo $this->Html->css('owl.carousel');

		echo $this->Html->script('jquery.min');
		echo $this->Html->script('jquery.etalage.min');
		echo $this->Html->script('owl.carousel');
		echo $this->Html->script('maskedinput.min');
		echo $this->Html->script('bootstrap.home.min');
		echo $this->Html->script('instafeed.min');

		echo $this->fetch('meta');
		echo $this->fetch('css');
		echo $this->fetch('script');

		?>
		<title><?php echo $this->fetch('title'); ?> | Cherrie Lingeries</title>
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta name="description" content="Página da Cherrie Lingeries, uma loja virtual de venda de lingeries" />
		<meta name="robots" content="index, follow" />
		<meta name="googlebot" content="index, follow" />
		<meta name="google-site-verification" content="sasESn-IcKf8NvykJNbO84d2MB1W30D5UaUqrpgWt5E" />
		<link rel="shortcut icon" href="<?php echo $this->Html->webroot('img/icone.png') ?>">

		<link href='http://fonts.googleapis.com/css?family=Varela+Round' rel='stylesheet' type='text/css'>
	</head>
	<body>
		<!-- header -->
		<div class="header">
			<!-- top-header -->
			<div class="top-header">
				<div class="container">
					<?php $user = $this->Session->read('Auth.User'); ?>
					<?php if(isset($user)): ?>
					<p class="usuario">Olá, <?php echo $user['nome'] ?> |
						<?php echo $this->Html->link('Sair', array('controller'=>'users','action'=>'logout')) ?>
					</p>
					<?php endif; ?>
					<div class="rigister-info">

		          <?php if(isset($user)): ?>
								<?php if($user['role'] === 'admin'): ?>
									<?php echo $this->Html->link('Painel de Controle', array('admin' => true, 'controller'=>'users','action'=>'index'), array('class' => 'linkHome')) ?>
								<?php else: ?>
									<?php echo $this->Html->link('Minha Conta', array('controller'=>'users','action'=>'index'), array('class' => 'linkHome')) ?>
								<?php endif ?>
								<?php echo " | "?>
								<?php $val = "(".count($this->Session->read('Carrinho.produtos')).")" ?>
								<?php echo $this->Html->link('Meu Carrinho '.$val, array('controller'=>'produtos','action'=>'ver_carrinho'), array('class' => 'linkHome')) ?>
		          <?php else: ?>
								<?php echo $this->Html->link('Entrar', array('controller'=>'users','action'=>'login'), array('class' => 'linkHome')) ?>
								<?php echo " | "?>
								<?php echo $this->Html->link('Cadastre-se', array('controller'=>'users','action'=>'add'), array('class' => 'linkHome')) ?>
		          <?php endif; ?>
							<div class="clearfix"> </div>

					</div>
					<div class="clearfix"> </div>
				</div>
			</div>
			<!-- /top-header -->
			<!-- bottom-header -->
			<div class="bottom-header">
				<div class="container">
					<div class="bottom-header-left"></div>
					<div class="logo">
						<a href="<?php echo FULL_BASE_URL ?>"><?php echo $this->Html->image("logo.png", array("title"=>"cherrie")); ?></a>
					</div>
					<div class="bottom-header-right">
						<div id="social-icons" style="text-align:center;">
						<a href="mailto:contato@cherriesp.com.br"><?php echo $this->Html->image("email.png", array("width"=>"48", "height"=>"48", "alt"=>"E-mail")) ?></a>
							<a href="http://www.facebook.com/cherriesp" target="_blank"><?php echo $this->Html->image("facebook-pink-flambe.png", array("width"=>"48", "height"=>"48", "alt"=>"Facebook")) ?></a>
							<a href="http://instagram.com/cherrie_sp/" target="_blank"><?php echo $this->Html->image("instagram.png", array("width"=>"48", "height"=>"48", "alt"=>"Instagram")) ?></a>
						</div>
					</div>
				</div>
			</div>
			<!-- /bottom-header -->
		</div>
		<!-- header -->
		<!--- top-nav -->
		<div class="top-nav">
			<div class="navbar main-menu">
				<div class="container-fluid">
					<div class="navbar-header">
					  <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#menu-col">
						<span class="sr-only">Toggle navigation</span>
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
					  </button>
					</div>
					<div class="collapse navbar-collapse" id="menu-col">
						<ul class="nav navbar-nav">
						<li><?php echo $this->Html->link('Home', '/')?></li>
						<?php if(isset($menu)): ?>
						<?php foreach($menu as $link): ?>
									<?php $isDropdown = (count($link['Tipo']) > 0); ?>
						  	<li class="<?php echo ($isDropdown) ? 'dropdown' : '' ?>"><?php echo $this->Html->link($link['Categoria']['nome'], array('controller' => 'produtos', 'action' => 'listar', 'categoria' => $link['Categoria']['id']))?>
						  <?php if($isDropdown): ?>
							<ul>
								<?php foreach($link['Tipo'] as $tipo): ?>
													<?php if($tipo['ativo']): ?>
								  <li>
									<?php echo $this->Html->link($tipo['nome'], array('controller' => 'produtos', 'action' => 'listar', 'tipo' => $tipo['id']))?>
								  </li>
													<?php endif ?>
								<?php endforeach; ?>
							</ul>
						  <?php endif; ?>
						  </li>
						<?php endforeach; ?>
					<?php endif; ?>
						</ul>
						<ul class="nav navbar-nav navbar-right">
							<li>
								<div class="search-box">
									<?php echo $this->Form->create('Produto', array('action' => 'buscar')); ?>
									<?php echo $this->Form->input('busca', array('type' => 'text', 'label' => false, 'placeholder' => 'Buscar', 'id' => 'search', 'div'=>false)); ?>
									<?php echo $this->Form->submit('', array('div' => false));?>
									<?php echo $this->Form->end(); ?>
								</div>
							</li>
						</ul>
					</div>
				</div>
			</div>
		</div>
		<!--- top-nav -->
		<!-- script-for-nav -->
		<script>
			$(document).ready(function(){
				$("span.menu").click(function(){
					$(".top-nav ul").slideToggle(500);
				});
			});
		</script>
		<!-- top-grids -->
		<!-- bottom-grids -->
		<div class="bottom-grids">
			<div class="container">
				<?php echo $this->Session->flash(); ?>
	      <?php echo $this->fetch('content'); ?>
			</div>
			<?php //echo $this->element('sql_dump'); ?>
		</div>
		<!-- bottom-grids -->
		<!-- footer -->
		<div class="footer">
			<div class="container">
				<div class="footer-grids">
					<div class="col-md-2 footer-grid">
						<h3>Informação</h3>
						<ul>
							<li>
								<?php echo $this->Html->link('Sobre Nós', array('controller' => 'pages', 'action' => 'empresa')) ?>
							</li>
						</ul>
					</div>
					<?php if(isset($menu)): ?>
					<div class="col-md-2 footer-grid">
						<h3>Mapa do Site</h3>
						<ul>
 							<?php foreach($menu as $link): ?>
 								<li><?php echo $this->Html->link($link['Categoria']['nome'], array('controller' => 'produtos', 'action' => 'listar', 'categoria' => $link['Categoria']['id']))?></li>
 							<?php endforeach; ?>
						</ul>
					</div>
				<?php endif; ?>
					<div class="col-md-2 footer-grid">
						<h3>Fale Conosco</h3>
						<ul>
							<li>
								<?php echo $this->Html->link('Contato', array('controller' => 'pages', 'action' => 'contato')) ?>
							</li>
							<li>
								<?php echo $this->Html->link('Sobre Trocas', array('controller' => 'pages', 'action' => 'sobre_trocas')) ?>
							</li>
						</ul>
					</div>
					<div class="col-md-3 footer-grid">
						<?php echo $this->Html->image('logo_dan_campos.png', array('class' => 'logo'));?>
					</div>
					<div class="clearfix"> </div>
				</div>
				<!-- social-icons -->
				<div class="social-icons text-center">
					<!-- INICIO CODIGO PAGSEGURO -->
					<center>
					<img class="pagseguro" src='https://p.simg.uol.com.br/out/pagseguro/i/banners/pagamento/todos_animado_550_50.gif' alt = 'Logotipos de meios de pagamento do PagSeguro' title = 'Este site aceita pagamentos com Visa, MasterCard, Diners, American Express, Hipercard, Aura, Elo, PLENOCard, PersonalCard, BrasilCard, FORTBRASIL, Cabal, Mais!, Avista, Grandcard, Sorocred, Bradesco, Itaú, Banco do Brasil, Banrisul, Banco HSBC, saldo em conta PagSeguro e boleto.' />
					</center>
					<!-- FINAL CODIGO PAGSEGURO -->
				</div>
				<!-- social-icons -->
				<!-- footer-bottom -->
				<div class="footer-bottom">
					<div class="footer-bottom-left">
						<p>Copyright Cherrie &#169; 2015 Todos os direitos Reservados | Todo conteúdo do site é de propriedade exclusiva da Cherrie</p>
						<p>Rua Coronel Domingos Ortiz, 174, 1º andar, sala 3, Centro, CEP 07851-040, Franco da Rocha/SP - Brasil | CNPJ: 20.696.358/0001-08</p>
					</div>
					<div class="clearfix"> </div>
					<!-- footer-bottom -->
				</div>
			</div>
		</div>
		<!-- footer -->
		<!-- container -->
		<script>
		$( document ).ready(function() {
    		jQuery(function($){
			   $(".date").mask("99/99/9999",{placeholder:"dd/mm/aaaa"});
			   $(".ddd").mask("99");
			   $(".address-number").mask("999999999");
			   $(".cpf").mask("999.999.999-99");
			   $(".cep").mask("99999-999");
			});

			$('.phone').keypress(function(){
			   	if($(this).val().length == 9){
			   		$(this).mask("9999-9999");
			   	}else if($(this).val().length == 10){
			   		$(this).mask("99999-9999");
			   	}
			});
		});
		</script>

	</body>
</html>
